
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<?php




////////////////////////////////////////////////////////////////////////////////////////////////

class register
{
public  function login($username,$password)
{
		$query="SELECT `userID` , `flag` ,`password` ,`fname` FROM `user` WHERE `fname`='$username' AND `password` ='$password'  ";

		if($query_run=mysql_query($query))
		{
			$query_num_rows=mysql_num_rows($query_run);
			if($query_num_rows==0)
			{
				echo 'invalid usernmae and password';	
				}	
		 else if($query_num_rows==1)
	  	{
				
					//session flag
				 $user_flag=mysql_result($query_run,0,'flag');
				 $_SESSION['flag_user']=$user_flag;
				  //session name
				   $user_name=mysql_result($query_run,0,'fname');
				  $_SESSION['user_name']=$user_name;
				  
				 //session password
				  $user_pass=mysql_result($query_run,0,'password');
				  $_SESSION['user_pass']=$user_pass;
				  //session login
				  //session password
				  $_SESSION['login']=1;

				  if( $_SESSION['flag_user']==0)
				  {
					 // echo "welcome ".$_SESSION['user_name'].'</br>';
					  }	
				   else 
				   {
				    // echo "WELCOME OUR ADMINE </br>";
					 
					 
				   }
				   // echo'you are log in log<a href="logout.php">logout </a>';
					//header('location:index.php');
				}
		
}
}
}
?>




<body>
</body>
</html>